package com.example.anan.AAChartCore.ChartsDemo.MainContent.slice;

import com.example.anan.AAChartCore.AAChartCoreLib.AAChartCreator.AAChartModel;
import com.example.anan.AAChartCore.AAChartCoreLib.AAChartCreator.AAChartView;
import com.example.anan.AAChartCore.AAChartCoreLib.AAChartCreator.AASeriesElement;
import com.example.anan.AAChartCore.AAChartCoreLib.AAChartEnum.AAChartAnimationType;
import com.example.anan.AAChartCore.AAChartCoreLib.AAChartEnum.AAChartSymbolStyleType;
import com.example.anan.AAChartCore.AAChartCoreLib.AAChartEnum.AAChartType;
import com.example.anan.AAChartCore.AAChartCoreLib.AAChartEnum.AAChartVerticalAlignType;
import com.example.anan.AAChartCore.AAChartCoreLib.AAOptionsModel.AADataLabels;
import com.example.anan.AAChartCore.AAChartCoreLib.AAOptionsModel.AAPie;
import com.example.anan.AAChartCore.AAChartCoreLib.AAOptionsModel.AAStyle;
import com.example.anan.AAChartCore.AAChartCoreLib.AAOptionsModel.AATooltip;
import com.example.anan.AAChartCore.AAChartCoreLib.AATools.AAColor;
import com.example.anan.AAChartCore.AAChartCoreLib.AATools.AAGradientColor;
import com.example.anan.AAChartCore.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;

import java.util.HashMap;
import java.util.Map;

public class SpecialChartAbilitySlice extends AbilitySlice {

    private AAChartModel aaChartModel;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_special_chart);
        try {
            int color = getResourceManager().getElement(ResourceTable.Color_status_bar_color).getColor();
            getWindow().setStatusBarColor(color);
        } catch (Exception e) {
            e.printStackTrace();
        }
        AAChartView aaChartView = (AAChartView) findComponentById(ResourceTable.Id_AAChartView);

        String chartType = intent.getStringParam("chartType");

        aaChartModel = configureChartModelWithChartType(chartType);

        aaChartView.aa_drawChartWithChartModel(aaChartModel);
    }

    AAChartModel configureChartModelWithChartType(String chartType) {
        switch (chartType) {
            case AAChartType.Column:
                return configureColumnChart();
            case AAChartType.Pie:
                return configurePieChart();
            case AAChartType.Bubble:
                return configureBubbleChart();
            case AAChartType.Scatter:
                return configureScatterChart();
            case AAChartType.Arearange:
                return configureArearangeChart();
            case AAChartType.Areasplinerange:
                return configureAreasplinerangeChart();
            case AAChartType.Columnrange:
                return configureColumnrangeChart();
            case AAChartType.Line:
                return configureLineChart();
            case AAChartType.Area:
                return configureAreaChart();
            case AAChartType.Boxplot:
                return configureBoxplotChart();
            case AAChartType.Waterfall:
                return configureWaterfallChart();
            case AAChartType.Pyramid:
                return configurePyramidChart();
            case AAChartType.Funnel:
                return configureFunnelChart();
            case AAChartType.Errorbar:
                return configureErrorbarChart();
            default:
                break;
        }

        return configureColumnChart();
    }

    AAChartModel configureColumnChart() {
        return new AAChartModel()
                .chartType(AAChartType.Column)
                .polar(true)
                .dataLabelsEnabled(false)
                .categories(new String[]{
                        "January", "February", "March", "April", "May", "June",
                        "July", "August", "September", "October", "November", "December"})
                .series(new AASeriesElement[]{
                        new AASeriesElement()
                                .name("2018")
                                .data(new Object[]{
                                7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6})
                });
    }

    AAChartModel configurePieChart() {
        return new AAChartModel()
                .chartType(AAChartType.Pie)
                .backgroundColor("#ffffff")
                .title("LANGUAGE MARKET SHARES JANUARY,2020 TO MAY")
                .subtitle("virtual data")
                .dataLabelsEnabled(true)//是否直接显示扇形图数据
                .yAxisTitle("℃")
                .series(new AAPie[]{
                                new AAPie()
                                        .name("Language market shares")
                                        .innerSize("20%")
                                        .size(150f)
                                        .dataLabels(new AADataLabels()
                                                .enabled(true)
                                                .useHTML(true)
                                                .distance(5f)
                                                .format("<b>{point.name}</b>: <br> {point.percentage:.1f} %"))
                                        .data(new Object[][]{
                                        {"Java", 67},
                                        {"Swift", 999},
                                        {"Python", 83},
                                        {"OC", 11},
                                        {"Go", 30},
                                })
                                ,
                        }
                );
    }


    AAChartModel configureBubbleChart() {
        AASeriesElement[] elements = {
                new AASeriesElement()
                        .name("BubbleOne")
                        .data(new Object[][]{
                        {97, 36, 79},
                        {94, 74, 60},
                        {68, 76, 58},
                        {64, 87, 56},
                        {68, 27, 73},
                        {74, 99, 42},
                        {7, 93, 99},
                        {51, 69, 40},
                        {38, 23, 33},
                        {57, 86, 31},
                        {33, 24, 22}
                })
                ,
                new AASeriesElement()
                        .name("BubbleTwo")
                        .data(new Object[][]{
                        {25, 60, 87},
                        {2, 75, 59},
                        {11, 54, 8},
                        {86, 55, 93},
                        {5, 33, 88},
                        {90, 63, 44},
                        {91, 43, 17},
                        {97, 56, 56},
                        {15, 67, 48},
                        {54, 25, 81},
                        {55, 66, 11}
                })
                ,
                new AASeriesElement()
                        .name("BubbleThree")
                        .data(new Object[][]{
                        {47, 47, 21},
                        {20, 12, 66},
                        {6, 76, 91},
                        {38, 30, 60},
                        {57, 98, 64},
                        {61, 47, 80},
                        {83, 60, 13},
                        {67, 78, 75},
                        {64, 12, 55},
                        {30, 77, 82},
                        {88, 66, 13}
                })
                ,
        };

        return new AAChartModel()
                .chartType(AAChartType.Bubble)
                .title("AACHARTKIT BUBBLES")
                .subtitle("JUST FOR FUN")
                .yAxisTitle("℃")
                .gradientColorEnable(true)
                .colorsTheme(new String[]{
                        "#0c9674", "#7dffc0", "#d11b5f", "#facd32", "#ffffa0", "#EA007B"})
                .series(elements);

    }

    AAChartModel configureScatterChart() {
        AASeriesElement elementOne = new AASeriesElement()
                .name("Female")
                .color("#ff0000")
                .data(new Object[][]{
                        {161.2, 51.6}, {167.5, 59.0}, {159.5, 49.2}, {157.0, 63.0}, {155.8, 53.6},
                        {170.0, 59.0}, {159.1, 47.6}, {166.0, 69.8}, {176.2, 66.8}, {160.2, 75.2},
                        {172.5, 55.2}, {170.9, 54.2}, {172.9, 62.5}, {153.4, 42.0}, {160.0, 50.0},
                        {147.2, 49.8}, {168.2, 49.2}, {175.0, 73.2}, {157.0, 47.8}, {167.6, 68.8},
                        {159.5, 50.6}, {175.0, 82.5}, {166.8, 57.2}, {176.5, 87.8}, {170.2, 72.8},
                        {174.0, 54.5}, {173.0, 59.8}, {179.9, 67.3}, {170.5, 67.8}, {160.0, 47.0},
                        {154.4, 46.2}, {162.0, 55.0}, {176.5, 83.0}, {160.0, 54.4}, {152.0, 45.8},
                        {162.1, 53.6}, {170.0, 73.2}, {160.2, 52.1}, {161.3, 67.9}, {166.4, 56.6},
                        {168.9, 62.3}, {163.8, 58.5}, {167.6, 54.5}, {160.0, 50.2}, {161.3, 60.3},
                        {167.6, 58.3}, {165.1, 56.2}, {160.0, 50.2}, {170.0, 72.9}, {157.5, 59.8},
                        {167.6, 61.0}, {160.7, 69.1}, {163.2, 55.9}, {152.4, 46.5}, {157.5, 54.3},
                        {168.3, 54.8}, {180.3, 60.7}, {165.5, 60.0}, {165.0, 62.0}, {164.5, 60.3},
                        {156.0, 52.7}, {160.0, 74.3}, {163.0, 62.0}, {165.7, 73.1}, {161.0, 80.0},
                        {162.0, 54.7}, {166.0, 53.2}, {174.0, 75.7}, {172.7, 61.1}, {167.6, 55.7},
                        {151.1, 48.7}, {164.5, 52.3}, {163.5, 50.0}, {152.0, 59.3}, {169.0, 62.5},
                        {164.0, 55.7}, {161.2, 54.8}, {155.0, 45.9}, {170.0, 70.6}, {176.2, 67.2},
                        {170.0, 69.4}, {162.5, 58.2}, {170.3, 64.8}, {164.1, 71.6}, {169.5, 52.8},
                        {163.2, 59.8}, {154.5, 49.0}, {159.8, 50.0}, {173.2, 69.2}, {170.0, 55.9},
                        {161.4, 63.4}, {169.0, 58.2}, {166.2, 58.6}, {159.4, 45.7}, {162.5, 52.2},
                        {159.0, 48.6}, {162.8, 57.8}, {159.0, 55.6}, {179.8, 66.8}, {162.9, 59.4},
                        {161.0, 53.6}, {151.1, 73.2}, {168.2, 53.4}, {168.9, 69.0}, {173.2, 58.4},
                        {171.8, 56.2}, {178.0, 70.6}, {164.3, 59.8}, {163.0, 72.0}, {168.5, 65.2},
                        {166.8, 56.6}, {172.7, 88.8}, {163.5, 51.8}, {169.4, 63.4}, {167.8, 59.0},
                        {159.5, 47.6}, {167.6, 63.0}, {161.2, 55.2}, {160.0, 45.0}, {163.2, 54.0},
                        {162.2, 50.2}, {161.3, 60.2}, {149.5, 44.8}, {157.5, 58.8}, {163.2, 56.4},
                        {172.7, 62.0}, {155.0, 49.2}, {156.5, 67.2}, {164.0, 53.8}, {160.9, 54.4},
                        {162.8, 58.0}, {167.0, 59.8}, {160.0, 54.8}, {160.0, 43.2}, {168.9, 60.5},
                        {158.2, 46.4}, {156.0, 64.4}, {160.0, 48.8}, {167.1, 62.2}, {158.0, 55.5},
                        {167.6, 57.8}, {156.0, 54.6}, {162.1, 59.2}, {173.4, 52.7}, {159.8, 53.2},
                        {170.5, 64.5}, {159.2, 51.8}, {157.5, 56.0}, {161.3, 63.6}, {162.6, 63.2},
                        {160.0, 59.5}, {168.9, 56.8}, {165.1, 64.1}, {162.6, 50.0}, {165.1, 72.3},
                        {166.4, 55.0}, {160.0, 55.9}, {152.4, 60.4}, {170.2, 69.1}, {162.6, 84.5},
                        {170.2, 55.9}, {158.8, 55.5}, {172.7, 69.5}, {167.6, 76.4}, {162.6, 61.4},
                        {167.6, 65.9}, {156.2, 58.6}, {175.2, 66.8}, {172.1, 56.6}, {162.6, 58.6},
                        {160.0, 55.9}, {165.1, 59.1}, {182.9, 81.8}, {166.4, 70.7}, {165.1, 56.8},
                        {177.8, 60.0}, {165.1, 58.2}, {175.3, 72.7}, {154.9, 54.1}, {158.8, 49.1},
                        {172.7, 75.9}, {168.9, 55.0}, {161.3, 57.3}, {167.6, 55.0}, {165.1, 65.5},
                        {175.3, 65.5}, {157.5, 48.6}, {163.8, 58.6}, {167.6, 63.6}, {165.1, 55.2},
                        {165.1, 62.7}, {168.9, 56.6}, {162.6, 53.9}, {164.5, 63.2}, {176.5, 73.6},
                        {168.9, 62.0}, {175.3, 63.6}, {159.4, 53.2}, {160.0, 53.4}, {170.2, 55.0},
                        {162.6, 70.5}, {167.6, 54.5}, {162.6, 54.5}, {160.7, 55.9}, {160.0, 59.0},
                        {157.5, 63.6}, {162.6, 54.5}, {152.4, 47.3}, {170.2, 67.7}, {165.1, 80.9},
                        {172.7, 70.5}, {165.1, 60.9}, {170.2, 63.6}, {170.2, 54.5}, {170.2, 59.1},
                        {161.3, 70.5}, {167.6, 52.7}, {167.6, 62.7}, {165.1, 86.3}, {162.6, 66.4},
                        {152.4, 67.3}, {168.9, 63.0}, {170.2, 73.6}, {175.2, 62.3}, {175.2, 57.7},
                        {160.0, 55.4}, {165.1, 77.7}, {174.0, 55.5}, {170.2, 77.3}, {160.0, 80.5},
                        {167.6, 64.5}, {167.6, 72.3}, {167.6, 61.4}, {154.9, 58.2}, {162.6, 81.8},
                        {175.3, 63.6}, {171.4, 53.4}, {157.5, 54.5}, {165.1, 53.6}, {160.0, 60.0},
                        {174.0, 73.6}, {162.6, 61.4}, {174.0, 55.5}, {162.6, 63.6}, {161.3, 60.9},
                        {156.2, 60.0}, {149.9, 46.8}, {169.5, 57.3}, {160.0, 64.1}, {175.3, 63.6},
                        {169.5, 67.3}, {160.0, 75.5}, {172.7, 68.2}, {162.6, 61.4}, {157.5, 76.8},
                        {176.5, 71.8}, {164.4, 55.5}, {160.7, 48.6}, {174.0, 66.4}, {163.8, 67.3}});

        AASeriesElement elementTwo = new AASeriesElement()
                .name("Male")
                .color("rgba(119, 152, 191, 1)")
                .data(new Object[][]{
                        {174.0, 65.6}, {175.3, 71.8}, {193.5, 80.7}, {186.5, 72.6}, {187.2, 78.8},
                        {181.5, 74.8}, {184.0, 86.4}, {184.5, 78.4}, {175.0, 62.0}, {184.0, 81.6},
                        {180.0, 76.6}, {177.8, 83.6}, {192.0, 90.0}, {176.0, 74.6}, {174.0, 71.0},
                        {184.0, 79.6}, {192.7, 93.8}, {171.5, 70.0}, {173.0, 72.4}, {176.0, 85.9},
                        {176.0, 78.8}, {180.5, 77.8}, {172.7, 66.2}, {176.0, 86.4}, {173.5, 81.8},
                        {178.0, 89.6}, {180.3, 82.8}, {180.3, 76.4}, {164.5, 63.2}, {173.0, 60.9},
                        {183.5, 74.8}, {175.5, 70.0}, {188.0, 72.4}, {189.2, 84.1}, {172.8, 69.1},
                        {170.0, 59.5}, {182.0, 67.2}, {170.0, 61.3}, {177.8, 68.6}, {184.2, 80.1},
                        {186.7, 87.8}, {171.4, 84.7}, {172.7, 73.4}, {175.3, 72.1}, {180.3, 82.6},
                        {182.9, 88.7}, {188.0, 84.1}, {177.2, 94.1}, {172.1, 74.9}, {167.0, 59.1},
                        {169.5, 75.6}, {174.0, 86.2}, {172.7, 75.3}, {182.2, 87.1}, {164.1, 55.2},
                        {163.0, 57.0}, {171.5, 61.4}, {184.2, 76.8}, {174.0, 86.8}, {174.0, 72.2},
                        {177.0, 71.6}, {186.0, 84.8}, {167.0, 68.2}, {171.8, 66.1}, {182.0, 72.0},
                        {167.0, 64.6}, {177.8, 74.8}, {164.5, 70.0}, {192.0, 99.9}, {175.5, 63.2},
                        {171.2, 79.1}, {181.6, 78.9}, {167.4, 67.7}, {181.1, 66.0}, {177.0, 68.2},
                        {174.5, 63.9}, {177.5, 72.0}, {170.5, 56.8}, {182.4, 74.5}, {197.1, 90.9},
                        {180.1, 93.0}, {175.5, 80.9}, {180.6, 72.7}, {184.4, 68.0}, {175.5, 70.9},
                        {180.6, 72.5}, {177.0, 72.5}, {177.1, 83.4}, {181.6, 75.5}, {176.5, 73.0},
                        {175.0, 70.2}, {174.0, 73.4}, {165.1, 70.5}, {177.0, 68.9}, {192.0, 99.7},
                        {176.5, 68.4}, {169.4, 65.9}, {182.1, 75.7}, {179.8, 84.5}, {175.3, 87.7},
                        {184.9, 86.4}, {177.3, 73.2}, {167.4, 53.9}, {178.1, 72.0}, {168.9, 55.5},
                        {157.2, 58.4}, {180.3, 83.2}, {170.2, 72.7}, {177.8, 64.1}, {172.7, 72.3},
                        {165.1, 65.0}, {186.7, 86.4}, {165.1, 65.0}, {174.0, 88.6}, {175.3, 84.1},
                        {185.4, 66.8}, {177.8, 75.5}, {180.3, 93.2}, {180.3, 82.7}, {177.8, 58.0},
                        {177.8, 79.5}, {177.8, 78.6}, {177.8, 71.8}, {177.8, 88.8}, {163.8, 72.2},
                        {188.0, 83.6}, {198.1, 85.5}, {175.3, 90.9}, {166.4, 85.9}, {190.5, 89.1},
                        {166.4, 75.0}, {177.8, 77.7}, {179.7, 86.4}, {172.7, 90.9}, {190.5, 73.6},
                        {185.4, 76.4}, {168.9, 69.1}, {167.6, 84.5}, {175.3, 64.5}, {170.2, 69.1},
                        {190.5, 108.6}, {177.8, 86.4}, {190.5, 80.9}, {177.8, 87.7}, {184.2, 94.5},
                        {176.5, 80.2}, {177.8, 72.0}, {180.3, 71.4}, {171.4, 72.7}, {172.7, 84.1},
                        {172.7, 76.8}, {177.8, 63.6}, {177.8, 80.9}, {182.9, 80.9}, {170.2, 85.5},
                        {167.6, 68.6}, {175.3, 67.7}, {165.1, 66.4}, {185.4, 77.7}, {181.6, 70.5},
                        {172.7, 95.9}, {190.5, 84.1}, {179.1, 87.3}, {175.3, 71.8}, {170.2, 65.9},
                        {193.0, 95.9}, {171.4, 91.4}, {177.8, 81.8}, {177.8, 96.8}, {167.6, 69.1},
                        {167.6, 82.7}, {180.3, 75.5}, {182.9, 79.5}, {176.5, 73.6}, {186.7, 91.8},
                        {188.0, 84.1}, {188.0, 85.9}, {177.8, 81.8}, {174.0, 82.5}, {177.8, 80.5},
                        {171.4, 70.0}, {185.4, 81.8}, {185.4, 84.1}, {188.0, 90.5}, {188.0, 91.4},
                        {182.9, 89.1}, {176.5, 85.0}, {175.3, 69.1}, {175.3, 73.6}, {188.0, 80.5},
                        {188.0, 82.7}, {175.3, 86.4}, {170.5, 67.7}, {179.1, 92.7}, {177.8, 93.6},
                        {175.3, 70.9}, {182.9, 75.0}, {170.8, 93.2}, {188.0, 93.2}, {180.3, 77.7},
                        {177.8, 61.4}, {185.4, 94.1}, {168.9, 75.0}, {185.4, 83.6}, {180.3, 85.5},
                        {174.0, 73.9}, {167.6, 66.8}, {182.9, 87.3}, {160.0, 72.3}, {180.3, 88.6},
                        {167.6, 75.5}, {186.7, 66.8}, {175.3, 91.1}, {175.3, 67.3}, {175.9, 77.7},
                        {175.3, 81.8}, {179.1, 75.5}, {181.6, 84.5}, {177.8, 76.6}, {182.9, 85.0},
                        {177.8, 81.8}, {184.2, 77.3}, {179.1, 71.8}, {176.5, 87.9}, {188.0, 94.3},
                        {174.0, 70.9}, {167.6, 64.5}, {170.2, 77.3}, {167.6, 72.3}, {188.0, 87.3},
                        {174.0, 80.0}, {176.5, 82.3}, {180.3, 73.6}, {167.6, 74.1}, {188.0, 85.9},
                        {180.3, 73.2}, {167.6, 76.3}, {183.0, 65.9}, {183.0, 90.9}, {179.1, 89.1},
                        {170.2, 62.3}, {177.8, 82.7}, {179.1, 79.1}, {190.5, 98.2}, {177.8, 84.1},
                        {180.3, 83.2}, {180.3, 83.2}});

        AASeriesElement[] seriesElements = {elementOne, elementTwo};

        return new AAChartModel()
                .chartType(AAChartType.Scatter)
                .title("Height and weight distribution by sex")
                .yAxisTitle("kg")
                .markerRadius(8f)
                .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank)
                .series(seriesElements);
    }

    AAChartModel configureArearangeChart() {
        return new AAChartModel()
                .chartType(AAChartType.Arearange)
                .title("Twilight Hall day temperature fluctuation map")
                .subtitle("real-time monitoring data")
                .yAxisTitle("℃")
                .series(new AASeriesElement[]{
                        new AASeriesElement()
                                .name("2020")
                                .data(new Object[][]{
                                /* 2014-01-01 */
                                {138853800, 1.1, 4.7},
                                {138862440, 1.8, 6.4},
                                {138871080, 1.7, 6.9},
                                {138879720, 2.6, 7.4},
                                {138888360, 3.3, 9.3},
                                {138897000, 3.0, 7.9},
                                {138905640, 3.9, 6.0},
                                {138914280, 3.9, 5.5},
                                {138922920, -0.6, 4.5},
                                {138931560, -0.5, 5.3},
                                {138940200, -0.3, 2.4},
                                {138948840, -6.5, -0.4},
                                {138957480, -7.3, -3.4},
                                {138966120, -7.3, -2.3},
                                {138974760, -7.9, -4.2},
                                {138983400, -4.7, 0.9},
                                {138992040, -1.2, 0.4},
                                {139000680, -2.3, -0.1},
                                {139009320, -2.0, 0.3},
                                {139017960, -5.1, -2.0},
                                {139026600, -4.4, -0.5},
                                {139035240, -6.4, -2.7},
                                {139043880, -3.2, -0.5},
                                {139052520, -5.5, -0.8},
                                {139061160, -4.4, 2.4},
                                {139069800, -4.0, 1.1},
                                {139078440, -3.4, 0.8},
                                {139087080, -1.7, 2.6},
                                {139095720, -3.1, 3.9},
                                {139104360, -8, -1.9},
                                {139113000, -7, -2.8},
                                /* 2014-02-01 */
                                {139121640, -2.7, 2.6},
                                {139130280, -1.3, 8.2},
                                {139138920, 1.5, 7.7},
                                {139147560, -0.5, 5.3},
                                {139156200, -0.2, 5.2},
                                {139164840, 0.7, 4.8},
                                {139173480, 0.9, 5.7},
                                {139182120, 1.7, 3.9},
                                {139190760, 2.2, 8.8},
                                {139199400, 3.0, 6.6},
                                {139208040, 1.4, 5.4},
                                {139216680, 0.6, 5.1},
                                {139225320, 0.1, 7.8},
                                {139233960, 3.4, 7.3},
                                {139242600, 2.0, 5.9},
                                {139251240, 1.1, 4.7},
                                {139259880, 1.1, 4.4},
                                {139268520, -2.8, 2.6},
                                {139277160, -5.0, 0.1},
                                {139285800, -5.7, 0.2},
                                {139294440, -0.7, 3.9},
                                {139303080, 1.5, 7.8},
                                {139311720, 5.5, 8.8},
                                {139320360, 5.3, 11.7},
                                {139329000, 1.7, 11.1},
                                {139337640, 3.4, 9.3},
                                {139346280, 3.4, 7.3},
                                {139354920, 4.5, 8.0},
                                /* 2014-03-01 */
                                {139363560, 2.1, 8.9},
                                {139372200, 0.6, 6.1},
                                {139380840, 1.2, 9.4},
                                {139389480, 2.6, 7.3},
                                {139398120, 3.9, 9.5},
                                {139406760, 5.3, 9.9},
                                {139415400, 2.7, 7.1},
                                {139424040, 4.0, 8.6},
                                {139432680, 6.1, 10.7},
                                {139441320, 4.2, 7.6},
                                {139449960, 2.5, 9.0},
                                {139458600, 0.2, 7.0},
                                {139467240, -1.2, 6.9},
                                {139475880, 0.4, 6.7},
                                {139484520, 0.2, 5.1},
                                {139493160, -0.1, 6.0},
                                {139501800, 1.0, 5.6},
                                {139510440, -1.1, 6.3},
                                {139519080, -1.9, 0.3},
                                {139527720, 0.3, 4.5},
                                {139536360, 2.4, 6.7},
                                {139545000, 3.2, 9.2},
                                {139553640, 1.7, 3.6},
                                {139562280, -0.3, 7.9},
                                {139570920, -2.4, 8.6},
                                {139579560, -1.7, 10.3},
                                {139588200, 4.1, 10.0},
                                {139596840, 4.4, 14.0},
                                {139605480, 3.3, 11.0},
                                {139614120, 3.0, 12.5},
                                {139622400, 1.4, 10.4},
                                /* 2014-04-01 */
                                {139631040, -1.2, 8.8},
                                {139639680, 2.2, 7.6},
                                {139648320, -1.0, 10.1},
                                {139656960, -1.8, 9.5},
                                {139665600, 0.2, 7.7},
                                {139674240, 3.7, 6.4},
                                {139682880, 5.8, 11.4},
                                {139691520, 5.4, 8.7},
                                {139700160, 4.5, 12.2},
                                {139708800, 3.9, 8.4},
                                {139717440, 4.5, 8.0},
                                {139726080, 6.6, 8.4},
                                {139734720, 3.7, 7.3},
                                {139743360, 3.6, 6.7},
                                {139752000, 3.5, 8.3},
                                {139760640, 1.5, 10.2},
                                {139769280, 4.9, 9.4},
                                {139777920, 3.5, 12.0},
                                {139786560, 1.5, 13.1},
                                {139795200, 1.7, 15.6},
                                {139803840, 1.4, 16.0},
                                {139812480, 3.0, 18.4},
                                {139821120, 5.6, 18.8},
                                {139829760, 5.7, 17.2},
                                {139838400, 4.5, 16.4},
                                {139847040, 3.1, 17.6},
                                {139855680, 4.7, 18.9},
                                {139864320, 4.9, 16.6},
                                {139872960, 6.8, 15.6},
                                {139881600, 2.8, 9.2},
                                /* 2014-05-01 */
                                {139890240, -2.7, 10.5},
                                {139898880, -1.9, 10.9},
                                {139907520, 4.5, 8.5},
                                {139916160, -0.6, 10.4},
                                {139924800, 4.0, 9.7},
                                {139933440, 5.5, 9.5},
                                {139942080, 6.5, 13.2},
                                {139950720, 3.2, 14.5},
                                {139959360, 2.1, 13.5},
                                {139968000, 6.5, 15.6},
                                {139976640, 5.7, 16.2},
                                {139985280, 6.3, 15.3},
                                {139993920, 5.3, 15.3},
                                {140002560, 6.0, 14.1},
                                {140011200, 1.9, 7.7},
                                {140019840, 7.2, 9.8},
                                {140028480, 8.9, 15.2},
                                {140037120, 9.1, 20.5},
                                {140045760, 8.4, 17.9},
                                {140054400, 6.8, 21.5},
                                {140063040, 7.6, 14.1},
                                {140071680, 11.1, 16.5},
                                {140080320, 9.3, 14.3},
                                {140088960, 10.4, 19.3},
                                {140097600, 5.7, 19.4},
                                {140106240, 7.9, 17.9},
                                {140114880, 5.0, 22.5},
                                {140123520, 7.6, 22.0},
                                {140132160, 5.7, 21.9},
                                {140140800, 4.6, 20.0},
                                {140149440, 7.0, 22.0},
                                /* 2014-06-01 */
                                {140158080, 5.1, 20.6},
                                {140166720, 6.6, 24.6},
                                {140175360, 9.7, 22.2},
                                {140184000, 9.6, 21.6},
                                {140192640, 13.0, 20.0},
                                {140201280, 12.9, 18.2},
                                {140209920, 8.5, 23.2},
                                {140218560, 9.2, 21.4},
                                {140227200, 10.5, 22.0},
                                {140235840, 7.3, 23.4},
                                {140244480, 12.1, 18.2},
                                {140253120, 11.1, 13.3},
                                {140261760, 10.0, 20.7},
                                {140270400, 5.8, 23.4},
                                {140279040, 7.4, 20.1},
                                {140287680, 10.3, 21.9},
                                {140296320, 7.8, 16.8},
                                {140304960, 11.6, 19.7},
                                {140313600, 9.8, 16.0},
                                {140322240, 10.7, 14.4},
                                {140330880, 9.0, 15.5},
                                {140339520, 5.1, 13.3},
                                {140348160, 10.0, 19.3},
                                {140356800, 5.2, 22.1},
                                {140365440, 6.3, 21.3},
                                {140374080, 5.5, 21.1},
                                {140382720, 8.4, 19.7},
                                {140391360, 7.1, 23.3},
                                {140400000, 6.1, 20.8},
                                {140408640, 8.4, 22.6},
                                /* 2014-07-01 */
                                {140417280, 7.6, 23.3},
                                {140425920, 8.1, 21.5},
                                {140434560, 11.2, 18.1},
                                {140443200, 6.4, 14.9},
                                {140451840, 12.7, 23.1},
                                {140460480, 15.3, 21.7},
                                {140469120, 15.1, 19.4},
                                {140477760, 10.8, 22.8},
                                {140486400, 15.8, 29.7},
                                {140495040, 15.8, 29.0},
                                {140503680, 15.2, 30.5},
                                {140512320, 14.9, 28.1},
                                {140520960, 13.1, 27.4},
                                {140529600, 15.5, 23.5},
                                {140538240, 14.7, 20.1},
                                {140546880, 14.4, 16.8},
                                {140555520, 12.6, 18.5},
                                {140564160, 13.9, 24.4},
                                {140572800, 11.3, 26.9},
                                {140581440, 13.3, 27.4},
                                {140590080, 13.3, 29.7},
                                {140598720, 14.0, 28.8},
                                {140607360, 14.1, 29.8},
                                {140616000, 15.4, 31.1},
                                {140624640, 17.0, 26.5},
                                {140633280, 16.6, 27.1},
                                {140641920, 13.3, 25.6},
                                {140650560, 16.8, 21.9},
                                {140659200, 16.0, 22.8},
                                {140667840, 14.4, 19.0},
                                {140676480, 12.8, 18.1},
                                /* 2014-08-01 */
                                {140685120, 12.6, 18.0},
                                {140693760, 11.4, 19.7},
                                {140702400, 13.9, 18.9},
                                {140711040, 12.5, 19.9},
                                {140719680, 12.3, 23.4},
                                {140728320, 12.8, 23.3},
                                {140736960, 11.0, 20.4},
                                {140745600, 14.7, 22.4},
                                {140754240, 11.1, 23.6},
                                {140762880, 13.5, 20.7},
                                {140771520, 13.7, 23.1},
                                {140780160, 12.8, 19.6},
                                {140788800, 12.1, 18.7},
                                {140797440, 8.8, 22.4},
                                {140806080, 8.2, 20.1},
                                {140814720, 10.9, 16.3},
                                {140823360, 10.7, 16.1},
                                {140832000, 11.0, 18.9},
                                {140840640, 12.1, 14.7},
                                {140849280, 11.2, 14.4},
                                {140857920, 9.9, 16.6},
                                {140866560, 6.9, 15.7},
                                {140875200, 8.9, 15.3},
                                {140883840, 8.2, 17.6},
                                {140892480, 8.4, 19.5},
                                {140901120, 6.6, 19.9},
                                {140909760, 6.4, 19.7},
                                {140918400, 0, 0},
                                {140927040, 0, 0},
                                {140935680, 0, 0},
                                {140944320, 0, 0},
                                /* 2014-09-01 */
                                {140952960, 0, 0},
                                {140961600, 0, 0},
                                {140970240, 0, 0},
                                {140978880, 0, 0},
                                {140987520, 0, 0},
                                {140996160, 13.4, 13.4},
                                {141004800, 13.2, 17.1},
                                {141013440, 11.9, 18.9},
                                {141022080, 9.0, 15.9},
                                {141030720, 5.9, 17.5},
                                {141039360, 6.8, 16.2},
                                {141048000, 10.3, 19.9},
                                {141056640, 8.7, 17.9},
                                {141065280, 7.9, 19.1},
                                {141073920, 6.0, 20.1},
                                {141082560, 4.7, 19.9},
                                {141091200, 4.0, 18.8},
                                {141099840, 4.5, 17.9},
                                {141108480, 3.1, 16.1},
                                {141117120, 8.5, 12.2},
                                {141125760, 7.6, 13.8},
                                {141134400, 1.3, 12.6},
                                {141143040, 2.0, 10.9},
                                {141151680, 5.0, 10.8},
                                {141160320, 6.4, 10.1},
                                {141168960, 8.2, 13.3},
                                {141177600, 8.9, 11.8},
                                {141186240, 9.9, 15.9},
                                {141194880, 5.2, 12.5},
                                {141203520, 4.6, 11.7},
                                /* 2014-10-01 */
                                {141212160, 8.8, 12.1},
                                {141220800, 3.9, 12.3},
                                {141229440, 2.7, 18.1},
                                {141238080, 10.2, 18.2},
                                {141246720, 9.6, 17.9},
                                {141255360, 9.3, 17.5},
                                {141264000, 8.1, 12.7},
                                {141272640, 6.7, 11.2},
                                {141281280, 4.0, 10.0},
                                {141289920, 6.3, 10.2},
                                {141298560, 6.6, 10.7},
                                {141307200, 6.6, 10.3},
                                {141315840, 5.9, 10.4},
                                {141324480, 1.2, 10.6},
                                {141333120, -0.1, 9.2},
                                {141341760, -1.0, 9.4},
                                {141350400, -1.7, 8.3},
                                {141359040, -0.6, 7.5},
                                {141367680, 6.9, 10.1},
                                {141376320, 7.7, 10.5},
                                {141384960, 3.8, 9.7},
                                {141393600, 6.2, 8.6},
                                {141402240, 6.5, 9.2},
                                {141410880, 7.9, 10.7},
                                {141419520, 6.1, 10.9},
                                {141428160, 10.3, 13.1},
                                {141437160, 7.1, 13.3},
                                {141445800, 0.0, 10.1},
                                {141454440, 0.0, 5.7},
                                {141463080, 3.9, 4.6},
                                {141471720, 4.0, 4.8},
                                /* 2014-11-01 */
                                {141480360, 4.8, 11.2},
                                {141489000, 7.0, 8.5},
                                {141497640, 3.0, 9.8},
                                {141506280, 2.8, 5.9},
                                {141514920, 0.8, 4.8},
                                {141523560, -0.2, 2.9},
                                {141532200, -0.6, 5.5},
                                {141540840, 6.6, 10.3},
                                {141549480, 5.4, 7.3},
                                {141558120, 3.0, 8.4},
                                {141566760, 0.4, 3.2},
                                {141575400, -0.1, 6.8},
                                {141584040, 4.8, 8.8},
                                {141592680, 4.6, 8.5},
                                {141601320, 4.3, 7.7},
                                {141609960, 3.3, 7.5},
                                {141618600, -0.4, 3.2},
                                {141627240, 1.9, 4.7},
                                {141635880, -0.2, 3.7},
                                {141644520, -1.3, 2.1},
                                {141653160, -1.8, 0.9},
                                {141661800, -2.7, 1.3},
                                {141670440, 0.3, 2.5},
                                {141679080, 3.4, 6.5},
                                {141687720, 0.8, 6.1},
                                {141696360, -1.0, 1.3},
                                {141705000, 0.4, 3.1},
                                {141713640, -1.2, 1.9},
                                {141722280, -1.1, 2.8},
                                {141730920, -0.7, 1.8},
                                /* 2014-12-01 */
                                {141739560, 0.5, 2.5},
                                {141748200, 1.4, 3.2},
                                {141756840, 4.5, 10.2},
                                {141765480, 0.4, 10.0},
                                {141774120, 2.5, 3.7},
                                {141782760, 1.1, 5.0},
                                {141791400, 2.0, 4.4},
                                {141800040, 1.4, 2.2},
                                {141808680, 0.7, 4.6},
                                {141817320, 1.9, 3.9},
                                {141825960, -0.2, 3.7},
                                {141834600, -0.1, 1.7},
                                {141843240, -1.0, 3.8},
                                {141851880, 0.5, 5.4},
                                {141860520, -1.7, 5.6},
                                {141869160, 0.3, 2.8},
                                {141877800, -3.0, 0.4},
                                {141886440, -1.1, 1.5},
                                {141895080, 0.8, 3.4},
                                {141903720, 0.9, 4.4},
                                {141912360, 0.3, 3.9},
                                {141921000, 0.6, 5.3},
                                {141929640, 1.5, 4.4},
                                {141938280, 0, 0},
                                {141946920, 0, 0},
                                {141955560, 10.6, 4},
                                {141964200, 10.8, 5},
                                {141972840, 8.4, 4},
                                {141981480, 5.2, 2.4},
                                {141990120, 1.3, 2.5},
                                {141998760, 1.6, 4.2}
                        })
                        ,
                });
    }

    AAChartModel configureAreasplinerangeChart() {
        return new AAChartModel()
                .chartType(AAChartType.Areasplinerange)
                .title("Area spline range chart")
                .subtitle("virtual data")
                .yAxisTitle("℃")
                .series(new AASeriesElement[]{
                        new AASeriesElement()
                                .name("2020")
                                .color("#ff0000")//猩红色
                                .data(new Object[][]{
                                /* 2014-06-01 */
                                {140158080, 5.1, 20.6},
                                {140166720, 6.6, 24.6},
                                {140175360, 9.7, 22.2},
                                {140184000, 9.6, 21.6},
                                {140192640, 13.0, 20.0},
                                {140201280, 12.9, 18.2},
                                {140209920, 8.5, 23.2},
                                {140218560, 9.2, 21.4},
                                {140227200, 10.5, 22.0},
                                {140235840, 7.3, 23.4},
                                {140244480, 12.1, 18.2},
                                {140253120, 11.1, 13.3},
                                {140261760, 10.0, 20.7},
                                {140270400, 5.8, 23.4},
                                {140279040, 7.4, 20.1},
                                {140287680, 10.3, 21.9},
                                {140296320, 7.8, 16.8},
                                {140304960, 11.6, 19.7},
                                {140313600, 9.8, 16.0},
                                {140322240, 10.7, 14.4},
                                {140330880, 9.0, 15.5},
                                {140339520, 5.1, 13.3},
                                {140348160, 10.0, 19.3},
                                {140356800, 5.2, 22.1},
                                {140365440, 6.3, 21.3},
                                {140374080, 5.5, 21.1},
                                {140382720, 8.4, 19.7},
                                {140391360, 7.1, 23.3},
                                {140400000, 6.1, 20.8},
                                {140408640, 8.4, 22.6},
                        })
                        ,
                });
    }

    AAChartModel configureColumnrangeChart() {
        return new AAChartModel()
                .chartType(AAChartType.Columnrange)
                .title("TEMPERATURE VARIATION BY MONTH")
                .subtitle("observed in Gotham city")
                .yAxisTitle("℃")
                .categories(new String[]{"January", "February", "March", "April", "May", "June",
                        "July", "August", "September", "October", "November", "December"})
                .dataLabelsEnabled(true)
                .inverted(true)//x 轴是否垂直翻转
                .series(new AASeriesElement[]{
                                new AASeriesElement()
                                        .name("temperature")
                                        .data(new Object[][]{
                                        {-9.7, 9.4},
                                        {-8.7, 6.5},
                                        {-3.5, 9.4},
                                        {-1.4, 19.9},
                                        {0.0, 22.6},
                                        {2.9, 29.5},
                                        {9.2, 30.7},
                                        {7.3, 26.5},
                                        {4.4, 18.0},
                                        {-3.1, 11.4},
                                        {-5.2, 10.4},
                                        {-13.5, 9.8}
                                })
                                ,
                        }
                );
    }

    AAChartModel configureLineChart() {
        return new AAChartModel()
                .chartType(AAChartType.Line)//图形类型
                .animationType(AAChartAnimationType.Bounce)//图形渲染动画类型为"bounce"
                .title("STEP LINE CHART")//图形标题
                .subtitle("2020/08/08")//图形副标题
                .dataLabelsEnabled(false)//是否显示数字
                .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式
                .markerRadius(7f)//折线连接点半径长度,为0时相当于没有折线连接点
                .series(new AASeriesElement[]{
                        new AASeriesElement()
                                .name("Berlin")
                                .data(new Object[]{
                                        450, 432, 401, 454, 590, 530, 510})
                                .step("right")//设置折线样式为直方折线,折线连接点位置靠右👉
                        ,
                        new AASeriesElement()
                                .name("New York")
                                .data(new Object[]{
                                        220, 282, 201, 234, 290, 430, 410})
                                .step("center")//设置折线样式为直方折线,折线连接点位置居中
                        ,
                        new AASeriesElement()
                                .name("Tokyo")
                                .data(new Object[]{
                                        120, 132, 101, 134, 90, 230, 210})
                                .step("left")//设置折线样式为直方折线,折线连接点位置靠左👈
                        ,
                });
    }

    AAChartModel configureAreaChart() {
        return new AAChartModel()
                .chartType(AAChartType.Area)//图形类型
                .animationType(AAChartAnimationType.Bounce)//图形渲染动画类型为"bounce"
                .title("STEP AREA CHART")//图形标题
                .subtitle("2049/08/08")//图形副标题
                .dataLabelsEnabled(false)//是否显示数字
                .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank)//折线连接点样式
                .markerRadius(0f)//折线连接点半径长度,为0时相当于没有折线连接点
                .series(new AASeriesElement[]{
                        new AASeriesElement()
                                .name("Berlin")
                                .data(new Object[]{
                                        450, 432, 401, 454, 590, 530, 510})
                                .step(true)//设置折线样式为直方折线,折线连接点位置靠左👈
                        ,
                        new AASeriesElement()
                                .name("New York")
                                .data(new Object[]{
                                        220, 282, 201, 234, 290, 430, 410})
                                .step(true)//设置折线样式为直方折线,折线连接点位置靠左👈
                        ,
                        new AASeriesElement()
                                .name("Tokyo")
                                .data(new Object[]{
                                        120, 132, 101, 134, 90, 230, 210})
                                .step(true)//设置折线样式为直方折线,折线连接点位置靠左👈
                        ,
                });
    }

    AAChartModel configureBoxplotChart() {
        return new AAChartModel()
                .chartType(AAChartType.Boxplot)
                .title("BOXPLOT CHART")
                .subtitle("virtual data")
                .yAxisTitle("℃")
                .series(new AASeriesElement[]{
                        new AASeriesElement()
                                .name("Observed Data")
                                .color("#ef476f")
                                .fillColor(AAGradientColor.DeepSea)
                                .data(new Object[][]{
                                {760, 801, 848, 895, 965},
                                {733, 853, 939, 980, 1080},
                                {714, 762, 817, 870, 918},
                                {724, 802, 806, 871, 950},
                                {834, 836, 864, 882, 910}
                        })
                        ,
                });
    }

    AAChartModel configureWaterfallChart() {
        Map dataElement1 = new HashMap<String, Object>();
        dataElement1.put("name", "启动资金");
        dataElement1.put("y", 120000);

        Map dataElement2 = new HashMap<String, Object>();
        dataElement2.put("name", "产品收入");
        dataElement2.put("y", 569000);

        Map dataElement3 = new HashMap<String, Object>();
        dataElement3.put("name", "服务收入");
        dataElement3.put("y", 231000);

        Map dataElement4 = new HashMap<String, Object>();
        dataElement4.put("name", "正平衡");
        dataElement4.put("isIntermediateSum", true);
        dataElement4.put("color", "#ffd066");

        Map dataElement5 = new HashMap<String, Object>();
        dataElement5.put("name", "固定成本");
        dataElement5.put("y", -342000);

        Map dataElement6 = new HashMap<String, Object>();
        dataElement6.put("name", "可变成本");
        dataElement6.put("y", -233000);

        Map dataElement7 = new HashMap<String, Object>();
        dataElement7.put("name", "余额");
        dataElement7.put("isSum", true);
        dataElement7.put("color", "#04d69f");

        Map[] dataElementArr = new Map[]{
                dataElement1,
                dataElement2,
                dataElement3,
                dataElement4,
                dataElement5,
                dataElement6,
                dataElement7
        };

        return new AAChartModel()
                .chartType(AAChartType.Waterfall)
                .title("WATERFALL CHART")
                .subtitle("virtual data")
                .series(new AASeriesElement[]{
                        new AASeriesElement()
                                .color("#ef476f")
                                .borderWidth(0f)
                                .data(dataElementArr),
                });
    }

    AAChartModel configurePyramidChart() {
        return new AAChartModel()
                .chartType(AAChartType.Pyramid)
                .title("THE HEAT OF PROGRAM LANGUAGE")
                .subtitle("virtual data")
                .yAxisTitle("℃")
                .series(new AASeriesElement[]{
                        new AASeriesElement()
                                .name("2020")
                                .data(new Object[][]{
                                {"swift", 11850},
                                {"Objective-C", 12379},
                                {"JavaScript", 14286},
                                {"Go", 15552},
                                {"Python", 18654},
                        })
                        ,
                });
    }

    AAChartModel configureFunnelChart() {
        return new AAChartModel()
                .chartType(AAChartType.Funnel)
                .title("THE HEAT OF PROGRAM LANGUAGE")
                .subtitle("virtual data")
                .yAxisTitle("℉")
                .series(new AASeriesElement[]{
                        new AASeriesElement()
                                .name("2020")
                                .dataLabels(new AADataLabels()
                                        .enabled(true)
                                        .inside(true)
                                        .verticalAlign(AAChartVerticalAlignType.Middle)
                                        .color(AAColor.Black)
                                        .style(new AAStyle()
                                                .fontSize(25f)
                                                .textOutline("none")))
                                .data(new Object[][]{
                                {"swift", 11256},
                                {"Objective-C", 12365},
                                {"JavaScript", 13569},
                                {"Go", 15221},
                                {"Python", 16298},
                        })
                        ,
                });
    }


    AAChartModel configureErrorbarChart() {
        return new AAChartModel()
                .yAxisTitle("")
                .categories(new String[]{
                        "一月", "二月", "三月", "四月", "五月", "六月",
                        "七月", "八月", "九月", "十月", "十一月", "十二月"
                })
                .series(new Object[]{
                        new AASeriesElement()
                                .name("降水")
                                .type(AAChartType.Column)
                                .color("#06caf4")
                                .data(new Object[]{49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4})
                        ,
                        new AASeriesElement()
                                .name("降雨误差")
                                .type(AAChartType.Errorbar)
                                .lineWidth(2.5f)
                                .color(AAColor.Red)
                                .data(new Object[][]{{48, 51}, {68, 73}, {92, 110}, {128, 136}, {140, 150}, {171, 179}, {135, 143},
                                        {142, 149}, {204, 220}, {189, 199}, {95, 110}, {52, 56}})
                                .tooltip(new AATooltip()
                                .pointFormat("(误差范围: {point.low}-{point.high} mm)<br/>"))
                });
    }


}
